<?include_once "config.php"?>
<?include_once "dbconn.php"?>
<?
// access_token이 발급된 상태가 아니라면, OAuth 인증 절차 시작
if(!array_key_exists('access_token',$_SESSION)) {

	try {
		// Request Token 요청
		$request_token_info = $oauth->getRequestToken($request_token_url, $callback_url);

		// 얻어온 Request Token을 이후 Access Token과 교환하기 위해 session에 저장.
		$_SESSION["request_token_secret"] = $request_token_info["oauth_token_secret"];

		// 사용자 인증 URL로 redirect
		header('Location: '.$authorize_url.'?oauth_token='.$request_token_info['oauth_token']);
		exit;
	} catch(OAuthException $E) {
		print_r($E);
		exit;
	}
} else {
// Access Token이 이미 발급 되어 있는 상태면, 토큰 지정
	$oauth->setToken($_SESSION['access_token'],$_SESSION['access_token_secret']);
}
//print_r($_SESSION);
?>
<!DOCTYPE html> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<title><?=$TITLE?></title> 
<script type="text/javascript" src="js/libs/jquery-1.7.1.min.js" charset="utf-8"></script> 
<script type="text/javascript" src="http://apis.daum.net/maps/maps3.js?apikey=<?=$MAP_KEY?>" charset="utf-8"></script> 
<script type="text/javascript" src="js/main.js" charset="utf-8"></script> 
<script type="text/javascript" src="js/msg.js" charset="utf-8"></script> 

<link rel="stylesheet" type="text/css" href="/css/default.css">

</head> 
<body> 
<div id="top">
        <div class="inner">
                <ul>
                </ul>
                <h1><?=$TITLE?></h1>
        </div>
</div>

<div id="main-nav">
    <div class="inner">
        <ul>
        </ul>
    </div>
</div>

 	 
<div class='map' id="map"></div> 
<div class='right'>

	<div id="new_message-box">
	     <div class="top2"></div>
		<div class="mid2">
		    <TEXTAREA NAME="message" ID="message" ROWS="3" COLS="50"></TEXTAREA>
		    <input class="btn-submit" type="button" onClick="SendQuestion()" />
		    <input type="hidden" name="latitude" id="latitude" value="">
		    <input type="hidden" name="longitude" id="longitude" value="">
	        </div>
	     <div class="btm2"></div>
	</div>

	<div id="wrap">
	   <div id="content-wide">
		<div class="top"></div>
		<div class="mid">
		     <div id="questions" class='questions'></div>
		</div>
		<div class="btm"></div>
	   </div>
	</div>
</div>

<div id="bottom">
    <div class="inner">
         <p>Copyright <?=$TITLE?>(c) All rights reserved.</p>
    </div>
</div>

</body> 
</html> 
